import com.itFox.dao.orderMapper;
import com.itFox.dao.studentMapper;
import com.itFox.pojo.User;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;

public class restFindOrderDetailOfId {

    @Test
    public void test(){
        String resource = "config-mybatis.xml";
        InputStream is;
        try {
            is = Resources.getResourceAsStream(resource);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        SqlSessionFactory ssf = new SqlSessionFactoryBuilder().build(is);
        SqlSession ss = ssf.openSession(true);
        orderMapper sm = ss.getMapper(orderMapper.class);

        User user = sm.findOrderDetailOfId(2);
        System.out.println(user);
        System.out.println(user.getOrders());

    }
}
